"""
HDF5 DAQ应用程序配置文件
包含所有硬编码的常量、默认值和配置参数
"""

# 应用程序基本配置
# APP_TITLE = "HDF5 LLRF Data Viewer (By Xu)"
APP_GEOMETRY = (100, 100, 1200, 800)  # x, y, width, height (更宽以容纳树形结构)
CONTROLS_PANEL_MAX_WIDTH = 500
TREE_WIDGET_MIN_WIDTH = 350

# HDF5文件相关配置
HDF5_EXTENSIONS = ["*.h5", "*.hdf5", "*.hdf"]
DEFAULT_H5_FILENAME_DISPLAY = "请选择要打开的HDF5文件"

# 数据集名称模式匹配
AMP_PHASE_PATTERNS = {
    'amp_patterns': ['amp', 'Amp', 'AMP'],
    'phase_patterns': ['phase', 'Phase', 'PHASE']
}

# 默认绘图参数
DEFAULT_WAVEFORM_INDEX = 0
DEFAULT_SAMPLING_FREQ = 1.0  # MHz, 从HDF5文件中读取
DEFAULT_TIME_START = "0"
DEFAULT_TIME_END = "10000"
DEFAULT_FREQ_START = "0"
DEFAULT_FREQ_END = "500000"

# 绘图样式默认值
DEFAULT_FONT_SIZE = "10"
DEFAULT_LINE_WIDTH = "1"
DEFAULT_FIGURE_WIDTH = "12"
DEFAULT_FIGURE_HEIGHT = "8"

# 可选项列表
FONT_SIZE_OPTIONS = ["6", "8", "10", "12", "14", "16"]
LINE_WIDTH_OPTIONS = ["0.5", "1", "1.5", "2", "2.5"]
FIGURE_WIDTH_OPTIONS = [str(i) for i in range(8, 25)]
FIGURE_HEIGHT_OPTIONS = [str(i) for i in range(6, 20)]
TIME_UNIT_OPTIONS = ["[us]", "[ms]", "[s]", "[samples]"]
FREQ_UNIT_OPTIONS = ["[Hz]", "[kHz]", "[MHz]"]

# 时间单位换算
TIME_UNIT_SCALES = {
    '[us]': 1e6,
    '[ms]': 1e3,
    '[s]': 1,
    '[samples]': None  # 需要动态计算
}

# 菜单和快捷键
MENU_SHORTCUTS = {
    'load_files': 'Ctrl+O',
    'exit': 'Ctrl+Q'
}

# 应用程序信息
APP_ABOUT_TEXT = "HDF5 LLRF数据查看器V1.0 - Chengye Xu"

# 树形控件配置
TREE_HEADERS = ["名称", "类型", "形状", "数据类型", "大小"]
TREE_COLUMN_WIDTHS = [200, 80, 120, 100, 80]

# HDF5数据预览配置
MAX_PREVIEW_ITEMS = 10  # 最大预览数据点数
LARGE_DATASET_THRESHOLD = 1000000  # 大数据集阈值 